exports.mongoose = () => {
  const mongoose = require("mongoose");
  mongoose.connect("mongodb://localhost:27017/koa");

  //创建规则
  const Schema = new mongoose.Schema({
    name: {
      type: String,
    },
    age: {
      type: Number,
    },
    sex: {
      type: String,
    },
  });

  //创建模型 创建表 第一个参数是表的名字
  const Students = mongoose.model("students", Schema);
  new Students({ name: "zs", age: "19", sex: "男" }).save((err, data) => {
    console.log(data);
  });
};
